#include <sys/types.h>
#include "../include/ohsm.h"
#include "ohsm_u.h"


void 
print_allocation_policy (void) {
	
	int i;
	
	printf("\nprint_allocation_policy : Printing the allocation policy full from getopt.c");
	printf("\n GETOPT cnt_users is\t\t%d", allocpol->cnt_users);
	printf("\n GETOPT cnt_groups is\t\t%d", allocpol->cnt_groups);
	printf("\n GETOPT cnt_tiers is\t\t%d", allocpol->cnt_types);
	printf("\n GETOPT uidx is\t\t\t%d", allocpol->uidx);
	printf("\n GETOPT gidx is\t\t\t%d", allocpol->gidx);
	printf("\n GETOPT tidx is\t\t\t%d", allocpol->tidx);

	for (i = 0; i < allocpol->cnt_users; i++) {
		printf("\n GETOPT UID  :\t\t%d\tTier : \t%d", allocpol->uid_tier[i].uid, allocpol->uid_tier[i].tier);
	}
	for (i = 0; i < allocpol->cnt_groups; i++) {
		printf("\n GETOPT GID  :\t\t%d\tTier : \t%d", allocpol->gid_tier[i].gid, allocpol->gid_tier[i].tier);
	}
	for (i = 0; i < allocpol->cnt_types; i++) {
		printf("\n GETOPT Type :\t\t%s\tTier : \t%d", allocpol->type_tier[i].type, allocpol->type_tier[i].tier);
	}
	printf("\n");
}


void 
print_device_topology (void) {

	int i;

	printf("\nPrinting the Device Information from getopt.c\n");
	printf("\nOHSM: GETOPT:Printing the Dev info");
	printf("\nOHSM: GETOPT:Number of tiers   = \t%u ", dev_info->nr_tiers);
	printf("\nOHSM: GETOPT:Number of devices = \t%u \n", dev_info->nr_devices);
	
	for(i = 0 ; i < dev_info->dinfo_count; ++i) {
		if (!dev_info->device[i].tier)
			continue;
		printf("\nOHMS: GETOPT:Number = \t%u ", i);
		printf("\nOHSM: GETOPT:Tier   =  \t%u ", dev_info->device[i].tier);
		printf("\nOHSM: GETOPT:Device = \t%u ", (unsigned int) dev_info->device[i].dev_num);	
		printf("\nOHSM GETOPT:Length  = \t%lu ", dev_info->device[i].len);
		printf("\nOHSM GETOPT:Start   = \t%lu \n", dev_info->device[i].begin);
	}
}

void 
print_relocation_policy (void) {

	int i = 0;
	
	printf("\n\nPrinting the relocation policy from getopt.c");
	printf("\n\nNumber of Policies %d", relocpol->cnt_policies);
	printf("\n\nValue of pidx %d", relocpol->pidx);
	
	for (i = 0; i < relocpol->cnt_policies; i++) {
		printf("\n\n Policy Number : \t%d", i);
		printf("\n reloc_criteria_bitmap: \t%d", relocpol->policy[i].reloc_criteria_bitmap);
		printf("\n src_tier:\t%d", relocpol->policy[i].src_tier); 		
		printf("\n dest_tier:\t%d", relocpol->policy[i].dest_tier);
		printf("\n relation operator 1 %d", relocpol->policy[i].rel_ops[0]);
		printf("\n relation operator 2 %d", relocpol->policy[i].rel_ops[1]);
		printf("\n relation operator 3 %d", relocpol->policy[i].rel_ops[2]);
		printf("\n relation operator 4 %d", relocpol->policy[i].rel_ops[3]);
		printf("\n relation operator 5 %d", relocpol->policy[i].rel_ops[4]);

		printf("\n value 1 %lld", relocpol->policy[i].values[0]);
		printf("\n value 2 %lld", relocpol->policy[i].values[1]);
		printf("\n value 3 %lld", relocpol->policy[i].values[2]);
		printf("\n value 4 %lld", relocpol->policy[i].values[3]);
		printf("\n value 5 %lld", relocpol->policy[i].values[4]);	
	}
	printf("\n");
}
